package com.siss.tenancy.user.utils;

public class AjaxObj {
	
	public static AjaxObj success(String msg,Object obj) {
		return new AjaxObj(200, msg, obj);
	}
	public static AjaxObj success(String msg) {
		return new AjaxObj(200, msg);
	}
	public static AjaxObj success(Object obj) {
		return new AjaxObj(200, "SUCCESS", obj);
	}
	public static AjaxObj failure(String msg,Object obj) {
		return new AjaxObj(0, msg, obj);
	}
	public static AjaxObj failure(String msg) {
		return new AjaxObj(0, msg);
	}
	public static AjaxObj failure() {
		return new AjaxObj(500, "Fialure","未知错误");
	}
	/**
	 * 0表示失败
	 * 1表示成功
	 */
	private int result;
	/**
	 * 提示信息
	 */
	private String msg;
	/**
	 * 附加对象，用来存储一些特定的返回信息
	 */
	private Object data;
	public int getResult() {
		return result;
	}
	public void setResult(int result) {
		this.result = result;
	}
	public String getMsg() {
		return msg;
	}
	public void setMsg(String msg) {
		this.msg = msg;
	}
	public Object getData() {
		return data;
	}
	public void setData(Object data) {
		this.data = data;
	}
	
	public AjaxObj() {
		result = 1;
	}
	public AjaxObj(int result, String msg, Object data) {
		super();
		this.result = result;
		this.msg = msg;
		this.data = data;
	}
	public AjaxObj(int result, String msg) {
		super();
		this.result = result;
		this.msg = msg;
	}
	public AjaxObj(int result) {
		super();
		this.result = result;
	}
	
}
